/*
* @Author: Administrator
* @Date:   2018-01-10 09:05:53
* @Last Modified by:   Administrator
* @Last Modified time: 2018-01-27 15:27:21
*/
const path = require('path')
const HtmlWepackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')

const config = {
  entry: {
    server: [path.join(__dirname,'./client/server_entry.jsx')]
  },
  output: {
    filename: 'server/server.js',
    path: path.join(__dirname,'dist'),
    libraryTarget:'commonjs2'
  },
  externals: Object.keys(require('./package.json').dependencies),
  module: {
    rules: [
      {
        test:/\.(js|jsx)/,
        loader:'babel-loader',
        exclude:path.join(__dirname,'./node_modules/')
      },
      {
        test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
        loader: 'url-loader?limit=20000&name=resource/[name].[ext]'
      },
    ]
  },
  resolve: {
    extensions: ['.js', '.jsx']
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.API_BASE': '"http://localhost:3000"',
      'process.env.RENDER_METHOD': '"server"'
    })
  ]
}
module.exports = config
